package global {
	
	import UnityEngine.Camera;
	import UnityEngine.MonoBehaviour;
	import UnityEngine.Quaternion;
	import UnityEngine.Time;
	import UnityEngine.Vector3;
	import UnityEngine.Serialization.IDeserializable;
	import UnityEngine.Serialization.PPtrRemapper;
	import UnityEngine.Serialization.SerializedStateReader;
	import UnityEngine.Serialization.SerializedStateWriter;
	import System.Type;
	
	public class TP_Motor extends MonoBehaviour implements IDeserializable {
		
		public static var TP_Motor$instance$: TP_Motor;
		
		public var TP_Motor$moveSpeed$: Number = 0;
		
		public var TP_Motor$moveVector$: Vector3 = Vector3.cil2as::DefaultValue();
		
		public function TP_Motor_Constructor(): TP_Motor {
			this.MonoBehaviour_Constructor();
			this.TP_Motor$moveSpeed$ = Number(10);
			return this;
		}
		
		public function TP_Motor_Awake(): void {
			TP_Motor$instance$ = this;
		}
		
		public function TP_Motor_UpdateMotor(): void {
			this.TP_Motor_SnapAlignCharacterWithCamera();
			this.TP_Motor_ProcessMotion();
		}
		
		public function TP_Motor_ProcessMotion(): void {
			this.TP_Motor$moveVector$.cil2as::Assign(this.Component_transform.Transform_TransformDirection_Vector3(this.TP_Motor$moveVector$));
			if (this.TP_Motor$moveVector$.magnitude > Number(1)) {
				this.TP_Motor$moveVector$.cil2as::Assign(Vector3.Normalize_Vector3(this.TP_Motor$moveVector$));
			}
			this.TP_Motor$moveVector$.cil2as::Assign(Vector3.op_Multiply_Vector3_Single(this.TP_Motor$moveVector$, this.TP_Motor$moveSpeed$));
			this.TP_Motor$moveVector$.cil2as::Assign(Vector3.op_Multiply_Vector3_Single(this.TP_Motor$moveVector$, Time.deltaTime));
			TP_Controller.TP_Controller$characterController$.CharacterController_Move_Vector3(this.TP_Motor$moveVector$.cil2as::Copy());
		}
		
		public function TP_Motor_SnapAlignCharacterWithCamera(): void {
			if ((this.TP_Motor$moveVector$.x != Number(0)) || (this.TP_Motor$moveVector$.z != Number(0))) {
				this.Component_transform.rotation = Quaternion.Euler_Single_Single_Single(this.Component_transform.eulerAngles.x, Camera.mainCamera.Component_transform.eulerAngles.x, this.Component_transform.eulerAngles.z);
			}
		}
		
		cil2as static function DefaultValue(): TP_Motor {
			return new TP_Motor().TP_Motor_Constructor();
		}
		
		public function Deserialize(reader: SerializedStateReader): void {
			this.TP_Motor$moveSpeed$ = reader.ReadFloat();
			this.TP_Motor$moveVector$ = Vector3.cil2as::DefaultValue();
			reader.ReadIDeserializable(this.TP_Motor$moveVector$);
		}
		
		public function Serialize(writer: SerializedStateWriter): void {
			writer.WriteFloat(this.TP_Motor$moveSpeed$);
			writer.WriteIDeserializable(this.TP_Motor$moveVector$);
		}
		
		public function RemapPPtrs(remapper: PPtrRemapper): void {
		}
		
		public static function get $Type(): System.Type {
			return _$Type != null ? _$Type : (_$Type = new System.Type(TP_Motor, {"Awake" : "TP_Motor_Awake", "UpdateMotor" : "TP_Motor_UpdateMotor", "ProcessMotion" : "TP_Motor_ProcessMotion", "SnapAlignCharacterWithCamera" : "TP_Motor_SnapAlignCharacterWithCamera"}, MonoBehaviour.$Type));
		}
		
		public static var _$Type: System.Type;
	}
}
